From 118ac24b2c488f490ee8814336291a58eae45395 Mon Sep 17 00:00:00 2001
From: Adam Duskett <aduskett@gmail.com>
Date: Tue, 12 Oct 2021 13:21:19 -0700
Subject: [PATCH] add option to specify path to g-ir-compiler

By default, find_program (GIR_COMPILER_BIN g-ir-compiler) returns the host path
to g-ir-compiler, which is undesirable in a cross-compile environment.

Add an option to manually specify a path to the g-ir-compiler.

Signed-off-by: Adam Duskett <aduskett@gmail.com>
---
 core/CMakeLists.txt | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index c4982de..6584229 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -66,7 +66,13 @@ set_target_properties("${LIBCORE}" PROPERTIES
                       VERSION ${LIBCORE_VERSION}
                       )
 
-find_program (GIR_COMPILER_BIN g-ir-compiler)
+option(GIR_COMPILER_PATH "Specify a path to g-ir-compiler" OFF)
+if(GIR_COMPILER_PATH)
+  set(GIR_COMPILER_BIN "${GIR_COMPILER_PATH}")
+else()
+  find_program (GIR_COMPILER_BIN g-ir-compiler)
+endif(GIR_COMPILER_PATH)
+
 add_custom_target(${LIBCORE_GIR}.typelib ALL
                   COMMAND ${GIR_COMPILER_BIN} ${CMAKE_CURRENT_BINARY_DIR}/${LIBCORE_GIR}.gir
                   --output ${CMAKE_CURRENT_BINARY_DIR}/${LIBCORE_GIR}.typelib
-- 
2.30.2

